<template>
    <div>
        <hd-tab :tabs="tabs" />
        <div class="grid grid-cols-6 gap-2" v-loading="loading" style="min-height:200px">
            <div class="card" v-for="module in modules" :key="module.id">
                <div class="card-body text-center">
                    <img src="/images/login.jpeg" class="w-10 h-10 rounded-full inline-block" />
                    <div class="mt-3 text-base text-gray-800">
                        {{ module.title }}
                    </div>
                    <p class="mt-2 text-gray-600">
                        {{ module.description }}
                    </p>
                </div>
                <div class="card-footer text-center">
                    <el-button type="primary" size="mini" @click="admin(module)">管理模块</el-button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import tabs from './tabs'
export default {
    route: { path: `site/:sid/module/index` },
    data() {
        return {
            tabs,
            loading: true,
            modules: []
        }
    },
    async created() {
        this.modules = await axios.get(`site/${this.$route.params.sid}/module`)
        this.loading = false
    },
    methods: {
        admin(module) {
            location.href = `/${module.name}/site/${this.$route.params.sid}/admin`
        }
    }
}
</script>

<style></style>
